From: Sebastian Keller Date: Sat, 28 Feb 2026 21:26:15 +0000 (+0100) Subject: st/entry: Fix primary/secondary icon leak X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~28^2~4^2^2~16 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=1f7f4ca78ee5a5734fdf8257d8e379d4668042ac;p=gnome-shell.git st/entry: Fix primary/secondary icon leak _st_entry_set_icon() takes a ref when setting the primary/secondary icon, but the ref is not removed when unsetting the icon or the entry is destroyed. Since clutter_actor_add_child() already adds a ref to the icon, there is actually no need to manually add another ref. So stop doing that to fix this leak. This however also requires that StPasswordEntry takes ownership of its own icon that it may set or unset multiple times. Since it is initially floating we need to sink the ref for that. Part-of: (cherry picked from commit a3c6383d7428f951394a715341cd9ecac4172b7b) --- diff --git a/src/st/st-entry.c b/src/st/st-entry.c index e3a4b537f..963cb5a4a 100644 --- a/src/st/st-entry.c +++ b/src/st/st-entry.c @@ -1369,7 +1369,7 @@ _st_entry_set_icon (StEntry *entry, { ClutterAction *click_gesture; - *icon = g_object_ref (new_icon); + *icon = new_icon; clutter_actor_set_reactive (*icon, TRUE); clutter_actor_add_child (CLUTTER_ACTOR (entry), *icon); diff --git a/src/st/st-password-entry.c b/src/st/st-password-entry.c index 8c6204f37..df51b9fe3 100644 --- a/src/st/st-password-entry.c +++ b/src/st/st-password-entry.c @@ -224,6 +224,7 @@ st_password_entry_init (StPasswordEntry *entry) "style-class", "peek-password", "icon-name", "view-reveal-symbolic", NULL); + g_object_ref_sink (priv->peek_password_icon); st_entry_set_secondary_icon (ST_ENTRY (entry), priv->peek_password_icon); st_password_entry_set_show_peek_icon (entry, TRUE);